package server

import (
	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
	"github.com/go-emix/emix-gorm"
	"github.com/go-emix/emix-logrus"
	_ "github.com/jinzhu/gorm/dialects/mysql"
	"net/http"
)

// 路由集中分发
func Dispatcher() Handlers {
	notifyUrl := "wx/pay/result"
	httpNotifyUrl := NotifyHttp + "/" + notifyUrl
	emlogrus.Info(httpNotifyUrl)
	_ = emgorm.GetDb("test")
	return func(r *gin.Engine) {
		r.Use(LoggerMiddleware())
		r.Use(cors.Default())
		r.GET("health", func(c *gin.Context) {
			c.JSON(http.StatusOK, "ok")
		})
	}
}
